/*
	Copyright (C) 2011 Salil Bhagurkar

	This file is part of illusion

	illusion is free software: you can redistribute it and/or modify
	it under the terms of the GNU Lesser General Public License as
	published by the Free Software Foundation, either version 3 of
	the License, or (at your option) any later version.

	illusion is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public
	License along with illusion. 
	If not, see <http://www.gnu.org/licenses/>.
*/

#include <klib/lib.h>
#include <arch/power.h>
#include <kernel/console.h>
#include <kernel/errors.h>
#include <kernel/types.h>

/*Simple initializer for all kernel devices*/

int init_biosdisk();
int pckbd_init();
int fatfs_init();

static int (*driver_init[])() = {init_biosdisk, pckbd_init, fatfs_init};
static char *driver_init_names[] = {"BIOS Disk", "PC Keyboard", "FATxx File Systems"};

int kernel_devs_init()
{
	uint_t i, len = sizeof(driver_init) / sizeof(int (*)());
	for(i = 0; i < len; i++) {
		int err = driver_init[i]();
		if(err) {
			debug("Kernel device initialization [%s] failed with error [%s]\n", driver_init_names[i], get_error_name(err));
		}
	}
	return 0;
}
